

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Create Workbench Variables [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Workbench,Workbench Variables, Create,Workbench Variable Arguments,Workbench Variable Constructors">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Create Workbench Variables</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="creating_variables.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="invoking_methods.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText">Right-click on the required Class node in the </span><span class="f_UIControl">Project Browser</span><span class="f_BodyText"> and select the </span><span class="f_MenuKeyField">Create Workbench Instance</span><span class="f_BodyText"> menu option, or press </span><span class="f_MenuKeyField">[Ctrl]+[Shift]+[J]</span><span class="f_BodyText">. The menu option is also available from within a Class diagram.</span></p>
<p class="p_SubHeadingL2"><span class="f_SubHeadingL2">Naming the Workbench</span></p>
<p class="p_BodyText"><span class="f_BodyText">When you elect to create an instance of a type Enterprise Architect prompts you with the </span><span class="f_UIControl">Workbench</span><span class="f_BodyText"> dialog to name the variable. Each instance name must be unique for the workbench.</span></p>
<p class="p_TextIndentedL2"><img src="debug_work_create.png" width="363" height="193" border="0" alt="debug_work_create"></p>
<p class="p_SubHeadingL2"><span class="f_SubHeadingL2">Choosing a Constructor</span></p>
<p class="p_BodyText"><span class="f_BodyText">Having given the variable a name, you must now choose which constructor to use.</span></p>
<p class="p_BodyText"><span class="f_BodyText">If you do not define a constructor, or define a single constructor taking no arguments, the default constructor or the defined constructor is automatically invoked.</span></p>
<p class="p_BodyText"><span class="f_BodyText">Otherwise the following dialog displays. Select the constructor from the drop-down list and fill in any parameters required.</span></p>
<p class="p_TextIndentedL2"><img src="debug_workbench_ctor.png" width="440" height="354" border="0" alt="debug_workbench_ctor"></p>
<p class="p_SubHeadingL2"><span class="f_SubHeadingL2">Arguments</span></p>
<p class="p_BodyText"><span class="f_BodyText">In the dialog above, type any parameters required by the constructor.</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1" style="font-weight: bold;">Literals as arguments</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 65px; list-style-position: outside;">
<li><span class="f_Bulletlist3">Text:  &nbsp; &nbsp; &nbsp; &nbsp;abc or &quot;abc&quot; or &quot;a b c&quot;</span></li>
<li><span class="f_Bulletlist3">Numbers:  &nbsp; &nbsp; &nbsp; &nbsp;1 or 1.5</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1" style="font-weight: bold;">Objects as arguments</span></li>
</ul>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">If an argument is not a literal then you can supply it in the list only if you have already created an instance of that type in the workbench. You do this by typing the name of the instance as the argument. The debugger checks any name entered in an argument against its list of workbench instances, and substitutes that instance in the actual call to the method.</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1" style="font-weight: bold;">Strings as arguments</span></li>
</ul>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">Surrounding strings with quotes is unnecessary as anything you type for a string argument becomes the value of the string; for example, the only time you should surround strings with quotes is in supplying elements of a string array, or where the string is equal to the name of an existing workbench instance.</span></p>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">&quot;A b c&quot;</span></p>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">&quot;a b $ % 6 4&quot;</span></p>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">A b c d</span></p>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">As 5 7 ) 2 === 4</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1" style="font-weight: bold;">Arrays as arguments</span></li>
</ul>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">Enter the elements that compose the array, separated by commas.</span></p>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Arguments</span></p>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">String[] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;one,two,three,&quot;a book&quot;,&quot;a bigger book&quot;</span></p>
<p class="p_Bulletlist3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="f_Bulletlist3">CPerson[] &nbsp; &nbsp; &nbsp; &nbsp;Tom,Dick,Harry</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="952" bgcolor="#efeff7" style="width:952px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Note:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="952" bgcolor="#f7f7ff" style="width:952px; background-color:#f7f7ff;"><p class="p_TiporNoteText"><span class="f_TiporNoteText">If you enter text that matches the name of an existing instance, surround it in quotes to avoid the debugger passing the instance rather than a string.</span></p>
</td>
</tr>
</table>
</div>
<p class="p_TextIndentedL2"><img src="debug_work_invoke.png" width="441" height="352" border="0" alt="debug_work_invoke"></p>
<p class="p_SubHeadingL2"><span class="f_SubHeadingL2">Invoke</span></p>
<p class="p_BodyText"><span class="f_BodyText">Having chosen the constructor and supplied any arguments, click on the </span><span class="f_MenuKeyField">Invoke</span><span class="f_BodyText"> button to create the variable. Output confirming this action is displayed in the <a href="output.htm">Output tab</a>.</span></p>




            </div>
          </div>
        </div>



</div>


</body>
</html>
